package cn.mdmm.open.commons;

import java.util.HashMap;
import java.util.Map;

import cn.mdmm.open.entity.app.AppInfoModel;
import cn.mdmm.open.entity.method.ApiMethodCfgModel;


public final class OpenApiCommonConst {

	private OpenApiCommonConst() {
		
	}
	
	/** 返回数据格式 xml/json */
	public static final String FORMAT_JSON = "json";
	/** 返回数据格式 xml/json */
	public static final String FORMAT_XML = "xml";
	
	/**错误编码*/
	public static final String ERRORCODE = "errorCode";
	
	/** 返回数据格式 xml/json */
	public static final String APPLICATION_JSON = "application/json";
	/** 返回数据格式 xml/json */
	public static final String APPLICATION_XML = "application/xml";
	
	
	/** 系统级参数 */
	public static String[] SYSTEM_PARAM_ARRAY = new String[]{"method", "ver", "sign","timestamp"};
	/** timestamp */
	public static final String STRING_TIMESTAMP = "timestamp";
	/** 返回数据格式 xml/json */
	public static final String STRING_FORMAT = "format";
	/** 验证码 */
	public static final String STRING_SIGN = "sign";
	/** 版本号 */
	public static final String STRING_VER = "ver";
	/** 调用的接口名称 */
	public static final String STRING_METHOD = "method";
	/** 应用id*/
	public static final String STRING_APP_ID = "appId";
	/** appKey */
	public static final String STRING_APPKEY = "appKey";
	/** sessionKey */
	public static final String STRING_SESSIONKEY = "sessionKey";
	/** userId */
	public static final String STRING_USER_ID = "userId";
	
	public static final String STRING_IP = "ip";
	
	/** api调用正常 */
	public static final int RESULT_TYPE_1 = 1;
	
	/** api调用失败 */
	public static final int RESULT_TYPE_2 = 2;
	
	/** api调用正常、包含部分错误信息 */
	public static final int RESULT_TYPE_3 = 3;
	
	/** api被禁止，由于成功率过低 */
	public static final int RESULT_TYPE_4 = 4;
	
	/**接口级别0:不需要appKey*/
	public static final int L0 =0;
	/**接口级别1:需要appKey*/
	public static final int L1 =1;
	/**接口级别2:需要appKey和sessionKey*/
	public static final int L2 =2;
	/**接口级别3:需要appKey和sessionKey，一次失效*/
	public static final int L3 =3;
	
	public static final String IP_REGEX = "^((([1-9]|[1-9][0-9]|1\\d\\d|2[0-4]\\d|25[0-5])))\\.((([0-9]|[1-9][0-9]|1\\d\\d|2[0-4]\\d|25[0-5])))\\.((([0-9]|[1-9][0-9]|1\\d\\d|2[0-4]\\d|25[0-5]))|\\*)\\.((([0-9]|[1-9][0-9]|1\\d\\d|2[0-4]\\d|25[0-5]))|\\*)$";

	/**所有接口及级别*/
	public static final Map<String, ApiMethodCfgModel> allMethodMap = new HashMap<String, ApiMethodCfgModel>();
	/**所有app信息*/
	public static final Map<String, AppInfoModel> allAppInfoMap = new HashMap<String, AppInfoModel>();
}
